<template>
  <div>
    <p>您的当前余额为:{{balance}}</p>
  </div>
</template>

<script>
import instance from "../../utils/request";

export default {
  name: "Balance",
  data(){
    return {
      balance:0,//余额
      loginCardNo:''//卡号
    }
  },
  methods:{
    getBalance(){
      instance.get('/account/balance/'+this.loginCardNo).then(res=>{
        this.balance = res.data;
      });
    }
  },
  created() {
    this.loginCardNo = this.$route.params.cardno;
    if (typeof this.loginCardNo === 'undefined'){//未登录
      this.$router.push({name:'Login'});
    }
    this.getBalance();
  }
}
</script>

<style scoped>
p{
  margin-top: 50px;
  /*黑体*/
  font-family:SimHei;
  /*加粗*/
  font-weight: bold;
}
</style>
